<?php
class guestbookService extends commonService{
	public function t(){
		return array('guestbook');
	}
	
	public function mylist($condition=array(),$extra='',$extra_data=array()){
        $return=array();
        $query="select * from `{$this->t[0]}` where 1 {$extra} order by `id` desc";
        $p=new smart_pager(array($query,$extra_data),$this->m);
        //$p->address('&block_id=%block_id%','block_id',$condition['block_id']);
		foreach($condition as $k=>$v){
			$p->address("&{$k}=%{$k}%",$k,$v);
		}
        if($p->total_num>0){
            $return[]=$this->m->mselect($p->query,$extra_data);
            $return[]=$p;
        }
        return $return;
    }
	//删除
	public function del($id){
		$return=array();
		
		$query="select `id` from `{$this->t[0]}` where `id`=:id limit 1";
		$r=$this->m->select($query,array('id'=>$id));
		if(!$r['id']){
			$return[0]=false;
			return $return;
		}
		
		$return[0]=$this->model->_d($this->t[0],$id);
		return $return;
	}
	public function msg_type(){
		$arr=array(
			1=>'业务合作',
			2=>'意见建议',
			3=>'使用问题',
			4=>'页面错误',
			5=>'不良信息',
			6=>'其他',
		);
		return $arr;
	}
//
}